package com.cfec.educationplatform.Controller;

import com.cfec.educationplatform.service.impl.BetPraHistoryResultServiceImpl;
import com.cfec.educationplatform.util.ResultData;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@ApiOperation("错题功能")
@Slf4j
@RestController
@RequestMapping("/errTopic")
public class ErrTopicController {

    @Resource(name = "betPraHistoryResultServiceImpl")
    BetPraHistoryResultServiceImpl betPraHistoryResultService;

    @ApiOperation("/获取全部错题")
    @GetMapping("/getErrAll")
    public ResultData<Object> getErrAll(Long userId) {
        return betPraHistoryResultService.getErrAll(userId);
    }

    @ApiOperation("删除错题")
    @PostMapping("/deleteErr")
    public ResultData<Object> deleteErr(Long userId, Long resultId) {
        return betPraHistoryResultService.deleteErrByID(userId, resultId);
    }

    @ApiOperation("按分类获取错题集")
    @GetMapping("/getErrByClassify")
    public ResultData<Object> getErrByClassify(Long userId) {
        return betPraHistoryResultService.getErrByClassify(userId);
    }

    @ApiOperation("科目分布数据")
    @GetMapping("/getErrBySubject")
    public ResultData<Object> getErrBySubject(Long userId) {
        return betPraHistoryResultService.getErrBySubject(userId);
    }
}
